package com.kancy.spring.aop;

import java.lang.reflect.Method;

/**
 * JoinPoint
 *
 * @author kancy
 * @date 2020/2/19 1:53
 */
public class JoinPoint {
    private Object proxy;
    private Object target;
    private Method method;
    private Object[] args;
    private Object result;
    private Throwable throwable;

    public JoinPoint(Object proxy, Object target, Method method, Object[] args) {
        this.proxy = proxy;
        this.target = target;
        this.method = method;
        this.args = args;
    }

    public Object proceed() throws Throwable{
        return method.invoke(target, args);
    }

    public Object proceed(Object[] args) throws Throwable{
        return method.invoke(target, args);
    }

    public Object getProxy() {
        return proxy;
    }

    public Object getTarget() {
        return target;
    }

    public Method getMethod() {
        return method;
    }

    public Object[] getArgs() {
        return args;
    }

    public Object getResult() {
        return result;
    }

    public Throwable getThrowable() {
        return throwable;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public void setThrowable(Throwable throwable) {
        this.throwable = throwable;
    }
}
